
module.exports = {
  // 验证登录
  async getUser(req, res, next) {
    req.user = req.session.user
    next()
  },
  // 允许进入后台
  allowToAdmin(req, res, next) {
    const user = req.session.user
    if(user) {
      req.user = user
      next()
    } else {
      res.redirect('/user/login')
    }
  }
}